<?php
include '../konek.php';
session_start();
//var_dump($_SESSION);
//echo count($_SESSION);
if(!isset($_SESSION)){
	header('location:login.php');
	//var_dump($_SESSION);
}

$query = "SELECT * FROM account_technopreneur where ID_TECHNOPRENEUR=".$_SESSION['ID_TECHNOPRENEUR']." "; 
$hasil = mysql_query($query) or die("Query failed with error: ".mysql_error());
$data  = mysql_fetch_array($hasil);
?>

<html>
  <head>
    <title>Smart Commerce</title>
    <link href="../css/bootstrap.min.css" rel="stylesheet">
	<style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
    </style>
    <link href="../css/bootstrap-responsive.min.css" rel="stylesheet">
	<script src="../js/jquery-1.7.2.min.js"></script>
</head>
<body>
	<div class="navbar navbar-inverse navbar-fixed-top">
		<div class="navbar-inner">
			<div class="container">
			<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
			</a>
			
			<a class="brand" href="home_technopreneur.php">Beranda</a>
			<a class="brand">Tentang Kami</a>
			<a class="brand">Kontak</a>
			
				<div class="nav-collapse collapse">
				<form class="navbar-form pull-right" method="post">
				</form>
			<div class="navbar-form pull-right">
				<a href="profil_technopreneur.php" class="btn btn-small btn-primary">Profil</a>
				<a href="../logout.php" class="btn btn-small btn-primary">Logout</a>
			</div>
				
			    </div>
			</div>
		</div>
    </div>
	
	<div class="container">
		<div class="hero-unit"style="background-image:url('../images/header.jpg');" >
			<h1>Smart Commerce</h1>
			<blockquote class="pull-right"> 
				<p>Website khusus Technopreneur Surabaya</p>
			</blockquote>
		</div>
		
		<ul class="breadcrumb">
			<li><a href="home_technopreneur.php">Home</a> <span class="divider">/</span></li>
			<li><a href="profil_technopreneur.php">Profil</a> <span class="divider">/</span></li>
			<li class="active">Edit Profil</li>
		</ul>

		<?php
		if (!empty($_GET['message']) && $_GET['message'] == 'warning') {
		echo '<div class="alert alert-warning">Perubahan data tidak dapat dilakukan. Silahkan mencoba kembali<button class="close" data-dismiss="alert">&times;</button></div>';
		}
		?>
		<form class="form-horizontal" method="POST" action="../proses_update_profil.php">
		<div class="control-group">
			<label class="control-label" for="inputNama">Nama Lengkap*</label>
			<div class="controls">
				<input style="width:270px; height:30px" disabled='disable' type="text"  value="<?php echo $data['NAMA']; ?>"></input>
				<input type="hidden" name="name"  value="<?php echo $data['NAMA']; ?>">
				<i>
			</div>
		 </div>
	  <div class="control-group">
			<label class="control-label" for="inputUsername">Username*</label>
			<div class="controls">
				<input style="width:270px; height:30px" disabled='disable' type="text"  value="<?php echo $data['USERNAME']; ?>"></input>
				<input type="hidden" name="username"  value="<?php echo $data['USERNAME']; ?>">
				<i>
			</div>
		 </div>
	  <div class="control-group">
		<label class="control-label" for="inputPassword">Password*</label>
		<div class="controls">
		  <input style="width:270px; height:30px" type="password" name="password" value="<?php echo $data['PASSWORD']; ?>">
		</div>
	  </div>
	  <div class="control-group">
		<label class="control-label" for="inputEmail">Email*</label>
		<div class="controls">
		  <input style="width:270px; height:30px" type="email" name="email" value="<?php echo $data['EMAIL_TECHNOPRENEUR']; ?>">
		</div>
	  </div>
	  <div class="control-group">
		<label class="control-label" for="inputTelpon">No.Telp</label>
		<div class="controls">
		  <input class="numeric" style="width:270px; height:30px" type="text" name="telpon" value="<?php echo $data['NO_TELP']; ?>">
		</div>
	  </div>
	  <div class="control-group">
		<label class="control-label" for="inputAlamat">Alamat</label>
		<div class="controls">
		  <textarea class="input-xlarge" rows="5" name="alamat"><?php echo $data['ALAMAT']; ?></textarea><br>
		</div>
	  </div>
	  <div class="control-group">
		<label class="control-label" for="inputDeskripsi">Deskripsi Technopreneur</label>
		<div class="controls">
		  <textarea class="input-xlarge" rows="5" name="deskripsi"><?php echo $data['DESKRIPSI_TECHNOPRENEUR']; ?></textarea><br>
		</div>
	  </div>
	  <div class="control-group">
		<div class="controls">
		  <input type="hidden" name="id" value="<?php echo $data['ID_TECHNOPRENEUR']; ?>">
		  <button type="submit" class="btn" value="save">Simpan</button>
		  <a href="profil_technopreneur.php" class="btn">Batal</a>
		</div>
	  </div>
		</form>
	</div>
	<script>
$(document).ready(function(){

	$(".numeric").keypress(function(event) {
	  // Backspace, tab, enter, end, home, left, right
	  // We don't support the del key in Opera because del == . == 46.
	  var controlKeys = [8, 9, 13, 35, 36, 37, 39];
	  // IE doesn't support indexOf
	  var isControlKey = controlKeys.join(",").match(new RegExp(event.which));
	  // Some browsers just don't raise events for control keys. Easy.
	  // e.g. Safari backspace.
	  if (!event.which || // Control keys in most browsers. e.g. Firefox tab is 0
		  (49 <= event.which && event.which <= 57) || // Always 1 through 9
		  (48 == event.which && $(this).attr("value")) || // No 0 first digit
		  isControlKey) { // Opera assigns values for control keys.
		return;
	  } else {
		event.preventDefault();
	  }
	});
});
</script>
  </body>
</html>